n = int(input())
sum = 0
s = 1
i = 1
while i <= n:
    s = i * s
    sum = sum + s
    i = i + 1

print(sum)
